﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Wix.Aura.Common;
using Wix.Aura.UnitTests.Tools;
using Wix.Aura.Common.CustomTypes;

namespace Wix.Aura.UnitTests.Common {
	[TestFixture]
	public class ProgIdSerialization {
		[SetUp]
		public void SetUp() {
			prog = new ProgId("identifier", new List<ProgId>());
			allProg = new ProgId("id", new List<ProgId>());

			allProg.Advertise = YesNoType.Yes;
			allProg.Description = "description";
			allProg.Icon = "icon";
			allProg.IconIndex = 1;
			allProg.NoOpen = "noOpen";
		}

		ProgId prog;
		ProgId allProg;

		[Test]
		public void EmptyProgId() {
			XmlAssert.AreEqual(@"<ProgId Id=""identifier"" />", prog);
		}

		[Test]
		public void AllAttributes() { 
			allProg.ProgIdCollection.Add(prog);
			XmlAssert.AreEqual(@"<ProgId Id=""id"" Advertise=""yes"" Description=""description"" Icon=""icon"" IconIndex=""1"" NoOpen=""noOpen""><ProgId Id=""identifier"" /></ProgId>", allProg);
		}

		[Test]
		public void Extensions() {
			prog = new ProgId("ex", new List<Extension>() { new Extension() });
			XmlAssert.AreEqual(@"<ProgId Id=""ex"" > <Extension /></ProgId>", prog);
		}
	}
}
